﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FacePassword
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }
        private void button1_Click_1(object sender, EventArgs e)
        {
            
            if (Check() == true)
            {
                UserManager _user = new UserManager();
                string _email = textBox7.Text;
                string _email2 = comboBox5.SelectedText;

                if (_user.addUser(textBox1.Text, textBox3.Text, (_email + _email2), (comboBox2.SelectedText + comboBox4.SelectedText + comboBox3.SelectedText), comboBox1.SelectedText, textBox5.Text, textBox8.Text) == true)
                {
                    MessageBox.Show("Done !");
                    TrainUser _form3 = new TrainUser();
                    _form3.Show();
                }
                else
                    comboBox5.BackColor = Color.HotPink;
                    textBox7.BackColor = Color.HotPink;
                    MessageBox.Show("E_mail Exist Before !");
            }
            else
                MessageBox.Show("Please Fill All Feild");


        }
        private bool Check()
        {
            if (textBox1.Text != "" && textBox3.Text != "" && textBox5.Text != "" && textBox7.Text != "" && textBox8.Text != "")
            {
                
                if (textBox8.Text == textBox2.Text)
                    return true;
                else
                {
                    MessageBox.Show("The password you typed do not match. Please retype the password in both boxes.");
                    return false;
                }
            }
                
            else
                return false;

        }

       
    }
}
